﻿using System.Text.RegularExpressions;

namespace WS.EKA.Utilities
{
    public class RegexHelper
    {
        public static MatchCollection GetMatchCollection(string strContent, string strPattern)
        {
            Regex rx = new Regex(strPattern, RegexOptions.IgnoreCase | RegexOptions.Singleline);

            MatchCollection matches = rx.Matches(strContent);

            return matches;
        }

        public static Match GetMatch(string strContent, string strPattern, RegexOptions options)
        {
            Regex rx = new Regex(strPattern, options);

            Match match = rx.Match(strContent);

            return match;
        }

        public static Match GetMatch(string strContent, string strPattern)
        {
            return GetMatch(strContent, strPattern, RegexOptions.IgnoreCase | RegexOptions.Singleline);
        }

        public static bool IsMatch(string strContent, string strPattern)
        {
            return IsMatch(strContent, strPattern, RegexOptions.Singleline  | RegexOptions.IgnoreCase);
        }

        public static bool IsMatch(string strContent, string strPattern, RegexOptions options)
        {
            Regex rx = new Regex(strPattern, options);

            return rx.IsMatch(strContent);
        }
    }
}
